function MyAssociationCtrl($scope, $state, $http) {
    $scope.onPageChange = function () {
        console.log($scope.currentPage);
        $http({
            url: 'association/mine',
            method: 'get',
            params: {
                pageSize: 5,
                page: $scope.currentPage - 1
            },
        }).success(function (response) {
            $scope.list = response.content;
            $scope.pageCount = response.totalPages;
            // $scope.currentPage = response.page + 1;
        })
    };

    $scope.initPage = function () {
        console.log($scope.currentPage);
        $http({
            url: 'association/mine',
            method: 'get',
            params: {
                pageSize: 5,
                page: 0
            },
        }).success(function (response) {
            $scope.list = response.content;
            $scope.pageCount = response.totalPages;
            // $scope.currentPage = response.page + 1;
        })
    };

    $scope.initPage();
}

function AssociationDetailCtrl($scope, $state, $http, $stateParams) {
    $http({
        url: 'association/uid',
        method: 'get',
        params: {
            uid: $stateParams.associationUid
        },
    }).success(function (response) {
        console.log(response);
        $scope.association = response;

        $http({
            url: 'announcement/all',
            method: 'get',
            params: {
                uid: response.uid,
                pageSize: 5,
                page: 0
            },
        }).success(function (response) {
            $scope.announcementList = response;
            //$scope.announcementList = response.content;
            //$scope.announcementPageCount = response.totalPages;
        });

        $http({
            url: 'activity/all',
            method: 'get',
            params: {
                uid: response.uid,
                pageSize: 5,
                page: 0
            },
        }).success(function (response) {
            $scope.activityList = response;
            //$scope.activityList = response.content;
            //$scope.activityPageCount = response.totalPages;
        });
    });

    $scope.onAnnouncementPageChange = function () {
        console.log($scope.currentPage);
        $http({
            url: 'announcement/all',
            method: 'get',
            params: {
                uid: $scope.association.uid,
                pageSize: 5,
                page: $scope.currentAnnouncementPage - 1
            },
        }).success(function (response) {
            $scope.announcementList = response.content;
            $scope.announcementPageCount = response.totalPages;
            // $scope.currentPage = response.page + 1;
        })
    };

    $scope.onActivityPageChange = function () {
        console.log($scope.currentPage);
        $http({
            url: 'announcement/all',
            method: 'get',
            params: {
                uid: $scope.association.uid,
                pageSize: 5,
                page: $scope.currentActivityPage - 1
            },
        }).success(function (response) {
            $scope.activityList = response.content;
            $scope.activityPageCount = response.totalPages;
            // $scope.currentPage = response.page + 1;
        })
    };

}